﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="XnReader.WinRT.ChapterTextView"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:common="using:XnReader.WinRT.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Helper="using:XnReader.WinRT.Helper"
    xmlns:WinRT="using:XnReader.WinRT" mc:Ignorable="d">
    <Page.Resources>
        <WinRT:ConvertVisibility x:Key="coverter1"></WinRT:ConvertVisibility>
    </Page.Resources>
        <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid >
        <ScrollViewer x:Name="scrollViewer" 
            HorizontalAlignment="Left" 
            VerticalScrollBarVisibility="Disabled"
            HorizontalScrollBarVisibility="Auto" 
            VerticalScrollMode="Disabled" 
            HorizontalScrollMode="Auto"
            ZoomMode="Disabled">
            <StackPanel x:Name="spContent"  Grid.Row="1" Orientation="Horizontal" Margin="80,0,0,0" >
                <RichTextBlock x:Name="of" Width="550" OverflowContentTarget="{Binding ElementName=of1}" Padding="10,0,0,20" FontFamily="Microsoft YaHei">
                    <Paragraph x:Name="paragraphContent" FontSize="14" FontFamily="Microsoft YaHei">
                    </Paragraph>
                </RichTextBlock>
                <RichTextBlockOverflow x:Name="of1" Visibility="{Binding HasOverflowContent, ElementName=of, Mode=OneWay,Converter={StaticResource coverter1}}" Width="550" OverflowContentTarget="{Binding ElementName=of2}" Padding="10,0,0,20" Margin="20,0,0,0" />
                <RichTextBlockOverflow x:Name="of2" Visibility="{Binding HasOverflowContent, ElementName=of1, Mode=OneWay,Converter={StaticResource coverter1}}" Width="550" OverflowContentTarget="{Binding ElementName=of3}" Padding="10,0,0,20" Margin="20,0,0,0" />
                <RichTextBlockOverflow x:Name="of3" Visibility="{Binding HasOverflowContent, ElementName=of2, Mode=OneWay,Converter={StaticResource coverter1}}" Width="550" OverflowContentTarget="{Binding ElementName=of4}" Padding="10,0,0,20" Margin="20,0,0,0" />
                <RichTextBlockOverflow x:Name="of4" Visibility="{Binding HasOverflowContent, ElementName=of3, Mode=OneWay,Converter={StaticResource coverter1}}" Width="550" OverflowContentTarget="{Binding ElementName=of5}" Padding="10,0,0,20" Margin="20,0,0,0" />
                <RichTextBlockOverflow x:Name="of5" Visibility="{Binding HasOverflowContent, ElementName=of4, Mode=OneWay,Converter={StaticResource coverter1}}" Width="550" OverflowContentTarget="{Binding ElementName=of6}" Padding="10,0,0,20" Margin="20,0,0,0" />
                <RichTextBlockOverflow x:Name="of6" Visibility="{Binding HasOverflowContent, ElementName=of5, Mode=OneWay,Converter={StaticResource coverter1}}" Width="550" OverflowContentTarget="{Binding ElementName=of7}" Padding="10,0,0,20" Margin="20,0,0,0" />
                <RichTextBlockOverflow x:Name="of7" Visibility="{Binding HasOverflowContent, ElementName=of6, Mode=OneWay,Converter={StaticResource coverter1}}" Width="550" Padding="10,0,0,20" Margin="20,0,0,0" />
                </StackPanel>
        </ScrollViewer>
        <VisualStateManager.VisualStateGroups>
            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>
                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>-->
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="scrollViewer" Storyboard.TargetProperty="HorizontalScrollBarVisibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Disabled"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="scrollViewer" Storyboard.TargetProperty="VerticalScrollBarVisibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Auto"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="scrollViewer" Storyboard.TargetProperty="VerticalScrollMode">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Auto"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="scrollViewer" Storyboard.TargetProperty="HorizontalScrollMode">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Disabled"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="of" Storyboard.TargetProperty="Width">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="300"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="spContent" Storyboard.TargetProperty="Margin">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="0"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
